﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebApplication6
{
    public partial class shop : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            PagedDataSource Pgds = new PagedDataSource();     

            DataTable dt = SQLHelper.ExecuteDataTable("select * from t_fenlei ");

            Pgds.DataSource = dt.DefaultView;

            fenleilistRepeater.DataSource = Pgds;
            fenleilistRepeater.DataBind();

            //取最新的5条公告
            dt = SQLHelper.ExecuteDataTable(@"select * from ( SELECT   row_number()  over(order by id desc) AS num , * 
            FROM      t_gonggao ) as t where num<=5");

            Pgds.DataSource = dt.DefaultView;

            gonggaolistRepeater.DataSource = Pgds;
            gonggaolistRepeater.DataBind();

            //取销量最高的10条商品
            dt = SQLHelper.ExecuteDataTable(@"select * from ( SELECT   row_number()  over(order by xiaoliang desc) AS num , * 
            FROM      t_product ) as t where num<=10");

            Pgds.DataSource = dt.DefaultView;

            xiaolianglistRepeater.DataSource = Pgds;
            xiaolianglistRepeater.DataBind();


        }
    }
}
